package dao;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Date;
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;


/**
 * This class was autogenerated by Torque on:
 *
 * [Fri Jan 09 02:39:32 PST 2009]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Country
 */
public abstract class BaseCountry extends BaseObject
{
    /** The Peer class */
    private static final CountryPeer peer =
        new CountryPeer();

        
    /** The value for the countryid field */
    private int countryid;
      
    /** The value for the countrycode field */
    private String countrycode;
      
    /** The value for the countryname field */
    private String countryname;
  
    
    /**
     * Get the Countryid
     *
     * @return int
     */
    public int getCountryid()
    {
        return countryid;
    }

                                              
    /**
     * Set the value of Countryid
     *
     * @param v new value
     */
    public void setCountryid(int v) throws TorqueException
    {
    
                  if (this.countryid != v)
              {
            this.countryid = v;
            setModified(true);
        }
    
          
                                  
        // update associated Region
        if (collRegions != null)
        {
            for (int i = 0; i < collRegions.size(); i++)
            {
                ((Region) collRegions.get(i))
                    .setCountryid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByResidentialaddresscountryid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByResidentialaddresscountryid.get(i))
                    .setResidentialaddresscountryid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByCollegeaddresscountryid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByCollegeaddresscountryid.get(i))
                    .setCollegeaddresscountryid(v);
            }
        }
                                          
        // update associated StudentPersonalInformation
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid != null)
        {
            for (int i = 0; i < collStudentPersonalInformationsRelatedByGuardianaddresscountryid.size(); i++)
            {
                ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByGuardianaddresscountryid.get(i))
                    .setGuardianaddresscountryid(v);
            }
        }
                      }
  
    /**
     * Get the Countrycode
     *
     * @return String
     */
    public String getCountrycode()
    {
        return countrycode;
    }

                        
    /**
     * Set the value of Countrycode
     *
     * @param v new value
     */
    public void setCountrycode(String v) 
    {
    
                  if (!ObjectUtils.equals(this.countrycode, v))
              {
            this.countrycode = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Countryname
     *
     * @return String
     */
    public String getCountryname()
    {
        return countryname;
    }

                        
    /**
     * Set the value of Countryname
     *
     * @param v new value
     */
    public void setCountryname(String v) 
    {
    
                  if (!ObjectUtils.equals(this.countryname, v))
              {
            this.countryname = v;
            setModified(true);
        }
    
          
              }
  
         
                                
            
    /**
     * Collection to store aggregation of collRegions
     */
    protected List collRegions;

    /**
     * Temporary storage of collRegions to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initRegions()
    {
        if (collRegions == null)
        {
            collRegions = new ArrayList();
        }
    }

    /**
     * Method called to associate a Region object to this object
     * through the Region foreign key attribute
     *
     * @param l Region
     * @throws TorqueException
     */
    public void addRegion(Region l) throws TorqueException
    {
        getRegions().add(l);
        l.setCountry((Country) this);
    }

    /**
     * The criteria used to select the current contents of collRegions
     */
    private Criteria lastRegionsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getRegions(new Criteria())
     *
     * @throws TorqueException
     */
    public List getRegions() throws TorqueException
    {
        if (collRegions == null)
        {
            collRegions = getRegions(new Criteria(10));
        }
        return collRegions;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country has previously
     * been saved, it will retrieve related Regions from storage.
     * If this Country is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getRegions(Criteria criteria) throws TorqueException
    {
        if (collRegions == null)
        {
            if (isNew())
            {
               collRegions = new ArrayList();
            }
            else
            {
                      criteria.add(RegionPeer.COUNTRYID, getCountryid() );
                      collRegions = RegionPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(RegionPeer.COUNTRYID, getCountryid());
                      if (!lastRegionsCriteria.equals(criteria))
                {
                    collRegions = RegionPeer.doSelect(criteria);
                }
            }
        }
        lastRegionsCriteria = criteria;

        return collRegions;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getRegions(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getRegions(Connection con) throws TorqueException
    {
        if (collRegions == null)
        {
            collRegions = getRegions(new Criteria(10), con);
        }
        return collRegions;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country has previously
     * been saved, it will retrieve related Regions from storage.
     * If this Country is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getRegions(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collRegions == null)
        {
            if (isNew())
            {
               collRegions = new ArrayList();
            }
            else
            {
                       criteria.add(RegionPeer.COUNTRYID, getCountryid());
                       collRegions = RegionPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(RegionPeer.COUNTRYID, getCountryid());
                       if (!lastRegionsCriteria.equals(criteria))
                 {
                     collRegions = RegionPeer.doSelect(criteria, con);
                 }
             }
         }
         lastRegionsCriteria = criteria;

         return collRegions;
     }

                  
              
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related Regions from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getRegionsJoinCountry(Criteria criteria)
        throws TorqueException
    {
        if (collRegions == null)
        {
            if (isNew())
            {
               collRegions = new ArrayList();
            }
            else
            {
                            criteria.add(RegionPeer.COUNTRYID, getCountryid());
                            collRegions = RegionPeer.doSelectJoinCountry(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(RegionPeer.COUNTRYID, getCountryid());
                        if (!lastRegionsCriteria.equals(criteria))
            {
                collRegions = RegionPeer.doSelectJoinCountry(criteria);
            }
        }
        lastRegionsCriteria = criteria;

        return collRegions;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByResidentialaddresscountryid
     */
    protected List collStudentPersonalInformationsRelatedByResidentialaddresscountryid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByResidentialaddresscountryid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByResidentialaddresscountryid()
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByResidentialaddresscountryid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByResidentialaddresscountryid().add(l);
        l.setCountryRelatedByResidentialaddresscountryid((Country) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByResidentialaddresscountryid
     */
    private Criteria lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByResidentialaddresscountryid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddresscountryid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = getStudentPersonalInformationsRelatedByResidentialaddresscountryid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     * If this Country is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddresscountryid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid() );
                      collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                      if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByResidentialaddresscountryid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddresscountryid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = getStudentPersonalInformationsRelatedByResidentialaddresscountryid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     * If this Country is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByResidentialaddresscountryid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                       collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                       if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByResidentialaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByResidentialaddresscountryidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByResidentialaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.RESIDENTIALADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByResidentialaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByResidentialaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByResidentialaddresscountryid;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByCollegeaddresscountryid
     */
    protected List collStudentPersonalInformationsRelatedByCollegeaddresscountryid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByCollegeaddresscountryid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByCollegeaddresscountryid()
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByCollegeaddresscountryid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByCollegeaddresscountryid().add(l);
        l.setCountryRelatedByCollegeaddresscountryid((Country) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByCollegeaddresscountryid
     */
    private Criteria lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByCollegeaddresscountryid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddresscountryid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = getStudentPersonalInformationsRelatedByCollegeaddresscountryid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     * If this Country is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddresscountryid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid() );
                      collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                      if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByCollegeaddresscountryid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddresscountryid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = getStudentPersonalInformationsRelatedByCollegeaddresscountryid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     * If this Country is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByCollegeaddresscountryid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                       collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                       if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByCollegeaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByCollegeaddresscountryidJoinCountryRelatedByGuardianaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByCollegeaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.COLLEGEADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByCollegeaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByGuardianaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByCollegeaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByCollegeaddresscountryid;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collStudentPersonalInformationsRelatedByGuardianaddresscountryid
     */
    protected List collStudentPersonalInformationsRelatedByGuardianaddresscountryid;

    /**
     * Temporary storage of collStudentPersonalInformationsRelatedByGuardianaddresscountryid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initStudentPersonalInformationsRelatedByGuardianaddresscountryid()
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
        }
    }

    /**
     * Method called to associate a StudentPersonalInformation object to this object
     * through the StudentPersonalInformation foreign key attribute
     *
     * @param l StudentPersonalInformation
     * @throws TorqueException
     */
    public void addStudentPersonalInformationRelatedByGuardianaddresscountryid(StudentPersonalInformation l) throws TorqueException
    {
        getStudentPersonalInformationsRelatedByGuardianaddresscountryid().add(l);
        l.setCountryRelatedByGuardianaddresscountryid((Country) this);
    }

    /**
     * The criteria used to select the current contents of collStudentPersonalInformationsRelatedByGuardianaddresscountryid
     */
    private Criteria lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByGuardianaddresscountryid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddresscountryid() throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = getStudentPersonalInformationsRelatedByGuardianaddresscountryid(new Criteria(10));
        }
        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     * If this Country is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddresscountryid(Criteria criteria) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                      criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid() );
                      collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                      if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
                {
                    collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria);
                }
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getStudentPersonalInformationsRelatedByGuardianaddresscountryid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddresscountryid(Connection con) throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = getStudentPersonalInformationsRelatedByGuardianaddresscountryid(new Criteria(10), con);
        }
        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     * If this Country is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getStudentPersonalInformationsRelatedByGuardianaddresscountryid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                       criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                       collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                       if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
                 {
                     collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelect(criteria, con);
                 }
             }
         }
         lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

         return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
     }

                                                                                          
              
                    
                    
                                
                                                              
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinStudent(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinZipRelatedByResidentialaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByResidentialaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinProvinceRelatedByResidentialaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByResidentialaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinRegionRelatedByResidentialaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByResidentialaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinCountryRelatedByResidentialaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByResidentialaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinZipRelatedByCollegeaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByCollegeaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinProvinceRelatedByCollegeaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByCollegeaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinRegionRelatedByCollegeaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByCollegeaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinCountryRelatedByCollegeaddresscountryid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinCountryRelatedByCollegeaddresscountryid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinZipRelatedByGuardianaddresszipid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinZipRelatedByGuardianaddresszipid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinProvinceRelatedByGuardianaddressprovinceid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinProvinceRelatedByGuardianaddressprovinceid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                    
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Country is new, it will return
     * an empty collection; or if this Country has previously
     * been saved, it will retrieve related StudentPersonalInformationsRelatedByGuardianaddresscountryid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Country.
     */
    protected List getStudentPersonalInformationsRelatedByGuardianaddresscountryidJoinRegionRelatedByGuardianaddressregionid(Criteria criteria)
        throws TorqueException
    {
        if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid == null)
        {
            if (isNew())
            {
               collStudentPersonalInformationsRelatedByGuardianaddresscountryid = new ArrayList();
            }
            else
            {
                            criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                            collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(StudentPersonalInformationPeer.GUARDIANADDRESSCOUNTRYID, getCountryid());
                        if (!lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria.equals(criteria))
            {
                collStudentPersonalInformationsRelatedByGuardianaddresscountryid = StudentPersonalInformationPeer.doSelectJoinRegionRelatedByGuardianaddressregionid(criteria);
            }
        }
        lastStudentPersonalInformationsRelatedByGuardianaddresscountryidCriteria = criteria;

        return collStudentPersonalInformationsRelatedByGuardianaddresscountryid;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                            


          
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
              fieldNames.add("Countryid");
              fieldNames.add("Countrycode");
              fieldNames.add("Countryname");
              fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
          if (name.equals("Countryid"))
        {
                return new Integer(getCountryid());
            }
          if (name.equals("Countrycode"))
        {
                return getCountrycode();
            }
          if (name.equals("Countryname"))
        {
                return getCountryname();
            }
          return null;
    }
    
    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
          if (name.equals(CountryPeer.COUNTRYID))
        {
                return new Integer(getCountryid());
            }
          if (name.equals(CountryPeer.COUNTRYCODE))
        {
                return getCountrycode();
            }
          if (name.equals(CountryPeer.COUNTRYNAME))
        {
                return getCountryname();
            }
          return null;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
            if (pos == 0)
        {
                return new Integer(getCountryid());
            }
              if (pos == 1)
        {
                return getCountrycode();
            }
              if (pos == 2)
        {
                return getCountryname();
            }
              return null;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
          save(CountryPeer.getMapBuilder()
                .getDatabaseMap().getName());
      }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
       * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
       *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
          try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
      }

      /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
      /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
          if (!alreadyInSave)
        {
            alreadyInSave = true;


  
            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    CountryPeer.doInsert((Country) this, con);
                    setNew(false);
                }
                else
                {
                    CountryPeer.doUpdate((Country) this, con);
                }
            }

                                      
                
            if (collRegions != null)
            {
                for (int i = 0; i < collRegions.size(); i++)
                {
                    ((Region) collRegions.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByResidentialaddresscountryid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByResidentialaddresscountryid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByResidentialaddresscountryid.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByCollegeaddresscountryid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByCollegeaddresscountryid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByCollegeaddresscountryid.get(i)).save(con);
                }
            }
                                                    
                
            if (collStudentPersonalInformationsRelatedByGuardianaddresscountryid != null)
            {
                for (int i = 0; i < collStudentPersonalInformationsRelatedByGuardianaddresscountryid.size(); i++)
                {
                    ((StudentPersonalInformation) collStudentPersonalInformationsRelatedByGuardianaddresscountryid.get(i)).save(con);
                }
            }
                          alreadyInSave = false;
        }
      }


                          
      /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param  countryid ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
            setCountryid(((NumberKey) key).intValue());
        }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
            setCountryid(Integer.parseInt(key));
        }

  
    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
          return SimpleKey.keyFor(getCountryid());
      }

 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
     * related objects to isNew=true.
       */
      public Country copy() throws TorqueException
    {
        return copyInto(new Country());
    }
  
    protected Country copyInto(Country copyObj) throws TorqueException
    {
          copyObj.setCountryid(countryid);
          copyObj.setCountrycode(countrycode);
          copyObj.setCountryname(countryname);
  
                    copyObj.setCountryid(0);
                        
                                      
                
        List v = getRegions();
        for (int i = 0; i < v.size(); i++)
        {
            Region obj = (Region) v.get(i);
            copyObj.addRegion(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByResidentialaddresscountryid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByResidentialaddresscountryid(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByCollegeaddresscountryid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByCollegeaddresscountryid(obj.copy());
        }
                                                            
                
        v = getStudentPersonalInformationsRelatedByGuardianaddresscountryid();
        for (int i = 0; i < v.size(); i++)
        {
            StudentPersonalInformation obj = (StudentPersonalInformation) v.get(i);
            copyObj.addStudentPersonalInformationRelatedByGuardianaddresscountryid(obj.copy());
        }
                    
        return copyObj;
    }

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public CountryPeer getPeer()
    {
        return peer;
    }

    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Country:\n");
        str.append("Countryid = ")
           .append(getCountryid())
           .append("\n");
        str.append("Countrycode = ")
           .append(getCountrycode())
           .append("\n");
        str.append("Countryname = ")
           .append(getCountryname())
           .append("\n");
        return(str.toString());
    }
}
